package com.ymatou.config;

//@Configuration

/*
<context:component-scan base-package="cn.example"/>
        */

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.FilterType;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;

@ComponentScan(basePackages = {"com.ymatou"},
        excludeFilters = {
                @ComponentScan.Filter(type = FilterType.ANNOTATION, value = EnableWebMvc.class)
        })

@MapperScan(basePackages = "com.ymatou.mapper")
public class ApplicationContextXml {

        /**
        @Bean
        DruidDataSource comboPooledDataSource(DatabaseProperties databaseProperties) {

                DruidDataSource dataSource = new DruidDataSource();

                dataSource.setDriverClassName(databaseProperties.getDriver());
                dataSource.setUrl(databaseProperties.getUrl());
                dataSource.setUsername(databaseProperties.getUsername());
                dataSource.setPassword(databaseProperties.getPassword());
                dataSource.setInitialSize(5);
                dataSource.setMinIdle(20);
                dataSource.setMaxActive(100);

                return dataSource;
        }

        @Bean
        SqlSessionFactoryBean sqlSessionFactoryBean(DruidDataSource dataSource) throws IOException {

                SqlSessionFactoryBean factoryBean = new SqlSessionFactoryBean();

                factoryBean.setDataSource(dataSource);
                factoryBean.setMapperLocations(new PathMatchingResourcePatternResolver().getResources("classpath:mapper/*.xml"));

                return factoryBean;
        }*/
}
